//LazySingleton.java
package singletonAndMultiton;

/**
 * create instance when need.
 * @author:youtubezou
 * @version:2012-7-13
 */
public class LazySingleton {
	private static LazySingleton m_instance = null;

	public static void main(String[] args) {
		System.out.println(LazySingleton.getInstance());
	}
	
	private LazySingleton() {
	}

	public synchronized static LazySingleton getInstance() {
		if (m_instance == null)
			m_instance = new LazySingleton();
		return m_instance;
	}
	
	public String toString(){
		return "this is LazySingleton";
	}
}
